package com.niiwoo.civet.trade.service.invest;

import com.niiwoo.civet.trade.dto.common.*;
import com.niiwoo.civet.trade.dto.request.*;
import com.niiwoo.civet.trade.dto.request.fanliInvest.FanLiInvestingProjectPageRequestDTO;
import com.niiwoo.civet.trade.dto.request.myloan.InvestingProjectPageRequestDTO;
import com.niiwoo.civet.trade.dto.response.*;
import com.niiwoo.civet.trade.dto.response.fanliInvest.InvestingProjectPageResponseDTO;
import com.niiwoo.civet.trade.dto.response.invest.InvestmentRateInfoResponseDTO;
import com.niiwoo.civet.trade.dto.response.myloan.FanLiProjectDetailResponseDTO;
import com.niiwoo.civet.trade.enums.BorrowerTypeEnum;
import com.niiwoo.civet.trade.enums.InvestOrderCloseReasonEnum;
import com.niiwoo.civet.trade.enums.TradeConfigEnum;
import com.niiwoo.tripod.provider.dto.response.PageResponseDTO;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 *
 */
public interface InvestDubboService {

    /**
     * 立即投资
     *
     * @param investDubboRequest
     * @return
     */
    InvestOrderResponseDTO invest(InvestDubboRequest investDubboRequest);

    /**
     * 投资订单完成处理
     *
     * @param investOrderId
     * @param isSuccess
     */
    void investCompleteHandle(Long investOrderId, boolean isSuccess);

    /**
     * 投资订单完成处理
     *
     * @param investOrderId
     * @param isSuccess
     * @param isAbsolutely
     * @param queryTime
     */
    void investCompleteHandle(Long investOrderId, boolean isSuccess, boolean isAbsolutely, Date queryTime);

    /**
     * 投资订单批处理
     */
    void investOrderBatchProcess();

    /**
     * 删除售罄标的
     */
    void deleteSoldOutProject();

    /**
     * 获取我的投资订单
     *
     * @param userId
     * @param orderStatus
     * @param pageNumber
     * @param pageSize
     * @return
     */
    List<InvestOrderDTO> getMyInvestOrderPage(String userId, Integer orderStatus, Integer pageNumber, Integer pageSize);

    InvestEvaluationDTO addInvestEvaluation(String userId, Integer score, Byte isDefOpeartion);

    default InvestEvaluationDTO addInvestEvaluation(String userId, Integer score, Byte isDefOpeartion, Byte incomeSource) {
        throw new UnsupportedOperationException("");
    }

    InvestFlowConfigResponseDTO getSoldOutGuidance(@NotNull String userId);

    /**
     * 获取投资风险类型测评详情
     *
     * @param userId
     * @return
     */
    InvestEvaluationDTO getInvestEvaluationInfo(String userId);

    /**
     * 根据标的ID获取标的详情
     *
     * @param projectIdList
     * @return
     */
    List<FreshInvestingProjectDTO> getInvestingProjectInfo(List<Long> projectIdList);


    /**
     * @param projectId
     * @return
     */
    List<InvestedOrderDTO> getProjectInvestOrderList(Long projectId);

    default ProjectInvestOrderPageResponse getPageProjectInvestOrderList(ProjectInvestOrderPageRequest request) {
        return null;
    }

    /**
     * 获取首页投资理财标列表
     *
     * @return
     */
    List<InvestingProjectDTO> getInvestingProjectListGroupByDeadLine(String channelCode);


    /**
     * 获取我要投资列表（分页）
     *
     * @param investingProjectPageRequestDTO
     * @return
     */
    PageResponseDTO<InvestingProjectDTO> getInvestingProjectPage(InvestingProjectPageRequestDTO investingProjectPageRequestDTO, boolean isCheckProject);

    /**
     * 获取猜你想投列表
     *
     * @param projectId
     * @param borrowUserId
     * @param channelCode
     * @return
     */
    List<InvestingProjectDTO> getRecomendProjectList(Long projectId, String borrowUserId, String channelCode);

    /**
     * 查询系统投资配置
     *
     * @return
     */
    List<SysInvestConfigDTO> querySysInvestConfig();

    default List<InvestingQueryCondtionConfigDTO> queryInvestingQueryCondtionConfig(BorrowerTypeEnum borrowerType) {
        return null;
    }


    /**
     * 获取投资成功后投资订单信息
     *
     * @param investOrderId
     * @return
     */
    InvestSuccessInfoDTO getInvestSuccessInfo(Long investOrderId);

    /**
     * 获取投资订单信息信息（投资订单详情页头）
     *
     * @param investOrderId
     * @return
     */
    InvestOrderSimpleInfoResponseDTO getInvestOrderSimpleInfo(Long investOrderId);

    /**
     * 投资解冻成功
     *
     * @param investOrderId
     */
    void investCancelSuccess(Long investOrderId);

    /**
     * 投资解冻成功
     *
     * @param investOrderId 投资订单id
     * @param closeReason   关闭原因
     */
    default void investCancelSuccess(Long investOrderId, InvestOrderCloseReasonEnum closeReason) {
        throw new UnsupportedOperationException("unimplemented");
    }

    /**
     * 撤投批处理
     */
    void batchInvestCancel();

    /**
     * 获取极速借居间合同
     *
     * @param contractRequestDTO
     * @param userId
     * @return
     */
    FastLoanContractResponseDTO getFastLoanContractInfo(ContractRequestDTO contractRequestDTO, String userId);

    /**
     * 获取土巴兔机构居间借款合同
     *
     * @param contractRequestDTO
     * @param userId
     * @return
     */
    default OrgLoanContractResponseDTO getOrgLoanContractInfo(ContractRequestDTO contractRequestDTO, String userId) {
        throw new UnsupportedOperationException("getOrgLoanContractInfo方法未实现");
    }

    /**
     * 鸿特机构极速借居间合同
     * @return
     */
    default OrgCompanyFastLoanContractResponseDTO getOrgCompanyFastLoanContract(ContractRequestDTO contractRequestDTO, String userId) {
    	throw new UnsupportedOperationException("getOrgCompanyFastLoanContract方法未实现");
    }
    
    /**
     * 鸿特个人极速借居间合同
     * @param contractRequestDTO
     * @param userId
     * @return
     */
    default OrgPersonalFastLoanContractResponseDTO getOrgPersonalFastLoanContractResponseDTO(ContractRequestDTO contractRequestDTO, String userId) {
    	throw new UnsupportedOperationException("getOrgPersonalFastLoanContractResponseDTO方法未实现");
    }

    /**
     * 债权转让协议-受让人预览
     * @param creditorSaleId 债权转让ID
     * @param transferUserId 投资人用户ID
     * @param userId 投资人用户ID
     * @return CreditorTransferProtocolPreviewResponseDTO
     */
    default CreditorTransferProtocolPreviewResponseDTO creditorTransferProtocolPreview(Long creditorSaleId, String transferUserId, String userId){
        throw new UnsupportedOperationException("creditorTransferProtocolPreview方法未实现");
    }

    /**
     * 债权转让协议-出让人预览
     * @param investOrderId 投资订单ID
     * @param saleAmount 出让金额
     * @return TransferProtocolPreviewResponseDTO
     */
    default SaleCreditorTransferProtocolPreviewResponseDTO saleCreditorTransferProtocolPreview(Long investOrderId, BigDecimal saleAmount){
        throw new UnsupportedOperationException("creditorTransferProtocolPreview方法未实现");
    }

    /**
     * 根据用户id集合查询用户待收
     *
     * @param userIdList
     * @return
     */
    List<UserInvestDueInGroupDTO> getUserInvestDueInGroupByUserId(List<String> userIdList);

    /**
     * 获取极速借投资成功引导信息
     *
     * @param userId
     * @return
     */
    FastloanInvestSuccessDTO getFastloanInvestSuccessDTO(String userId);

    /**
     * 获取未完成存管操作的投资订单个数
     *
     * @param userId
     * @return
     */
    Integer getInvestingCount(String userId);

    /**
     * 根据投资人ID，投资订单查询投资人应收罚息
     *
     * @param userId
     * @param investOrderId
     * @return
     */
    @Deprecated
    default BigDecimal getPenaltyFee(String userId, Long investOrderId) {
        throw new UnsupportedOperationException("已作废");
    }


    /**
     * 验证用户的当前投资金额是否已达该风险类型投资上限
     *
     * @param userId
     */
    default void vaildSurplusCanInvestAmount(String userId, BigDecimal investAmout) {
        throw new UnsupportedOperationException("");
    }

    /**
     * 取消投资订单，手动网关投资&处理中可取消
     *
     * @param userId        用户id
     * @param investOrderId 投资订单id
     */
    default void cancelInvestOrder(@NotNull String userId, @NotNull Long investOrderId) {
        throw new UnsupportedOperationException("unimplemented");
    }

    /**
     * 支付投资订单，手动网关投资&处理中可取消
     *
     * @param userId            用户id
     * @param investOrderId     投资订单id
     * @param niiwooRedirectUrl 网关会跳H5地址
     */
    default InvestPaymentResponseDTO payInvestOrder(@NotNull String userId, @NotNull Long investOrderId, String niiwooRedirectUrl) {
        throw new UnsupportedOperationException("unimplemented");
    }
    /**
     *首页标的推荐信息
     * @return
     */
    default RecommendInvestResponseDTO queryRecommendInvest() {
    	throw new UnsupportedOperationException("unimplemented");
    }
    /**
     * 散列表查询筛选条件
     * @return
     */
	default FilterInvestConfigDTO queryNormalInvestingSelector(){
		throw new UnsupportedOperationException("unimplemented");
	}
	/**
	 * 债权出让确认
	 * @param investDubboRequest
	 * @return
	 */
	default InvestCreditResponseDTO investCreditor(InvestCreditDubboRequest investDubboRequest) {
		throw new UnsupportedOperationException("unimplemented");
	};

    /**
     * 首页接口入口判断
     * @param tradeConfigEnum
     * @return
     */
    default String  selectConfig(TradeConfigEnum tradeConfigEnum){
        throw new UnsupportedOperationException("unimplemented");
    }
    /**
     * 债权投资回调
     * @param investOrderId
     * @return
     */
	default CreditSuccessInfoDTO getCreditSuccessInfo(Long investOrderId){
		throw new UnsupportedOperationException("unimplemented");
	}
    /**
     * 返利投查询可投资信息记录
     * @param investingProjectPageRequestDTO
     * @return
     */
    default InvestingProjectPageResponseDTO getFanLiInvestingProjectPage(FanLiInvestingProjectPageRequestDTO investingProjectPageRequestDTO){
        throw new UnsupportedOperationException("unimplemented");
    }
    /**
     * 返利投查询可投资标的详情信息
     * @param projectId
     * @return
     */
    default FanLiProjectDetailResponseDTO getFanLiInvestingDetailPage(Long projectId){
        throw new UnsupportedOperationException("unimplemented");
    }

    default InvestFlowConfigResponseDTO getSoldOutGuidanceTransfer(String userId){
        throw new UnsupportedOperationException("unimplemented");
    }

    /**
     * 5.5.0新手投列表查询
     * @return
     */
    default PageResponseDTO<InvestingProjectDTO> getNoviceInvestList(NoviceInvestListRequestDTO requestDTO){
        throw new UnsupportedOperationException("unimplemented");
    }

    /**
     * 5.5.0新手投列表上部banner信息
     * @param userId
     * @return
     */
    default NoviceInvestInfoResponseDTO getNoviceInvestInfos(String userId,String channelCode){
        throw new UnsupportedOperationException("unimplemented");
    }

    default DripSummaryInfoRespDTO getMyInvestSummaryInfo(String userId){
        throw new UnsupportedOperationException("unimplemented");
    }

    /**
     * 查询标的费率配置集合
     * @param projectId
     * @param borrowUserId
     * @return
     */
    default List<ProjectRateDTO> queryProjectRateListOrderByCurrentPeriodAscByProjectIdAndBorrowUserId(Long projectId, String borrowUserId){
        throw new UnsupportedOperationException("unimplemented");
    }

    default RecommendInvestResponseDTO queryNoviceRecommendInvest(String userId){
        throw new UnsupportedOperationException("unimplemented");
    }

    default InvestmentRateInfoResponseDTO getInvestmentRateInfo(String userId){
        throw new UnsupportedOperationException("unimplemented");
    }
}
